package com.yzy.baselibrary.base.viewmodel

import androidx.lifecycle.Lifecycle
import androidx.lifecycle.LifecycleObserver
import androidx.lifecycle.LifecycleOwner
import androidx.lifecycle.OnLifecycleEvent
import org.jetbrains.annotations.NotNull

/**
 *description: ViewModel接口类.
 *@date 2018/10/15 16:23.
 *@author: YinZeYu.
 */
interface IViewModel : LifecycleObserver {

  @OnLifecycleEvent(Lifecycle.Event.ON_CREATE)
  fun onCreate(@NotNull lifecycleOwner: LifecycleOwner)

  @OnLifecycleEvent(Lifecycle.Event.ON_START)
  fun onStart(@NotNull lifecycleOwner: LifecycleOwner)

  @OnLifecycleEvent(Lifecycle.Event.ON_RESUME)
  fun onResume(@NotNull lifecycleOwner: LifecycleOwner)

  @OnLifecycleEvent(Lifecycle.Event.ON_PAUSE)
  fun onPause(@NotNull lifecycleOwner: LifecycleOwner)

  @OnLifecycleEvent(Lifecycle.Event.ON_STOP)
  fun onStop(@NotNull lifecycleOwner: LifecycleOwner)

  @OnLifecycleEvent(Lifecycle.Event.ON_DESTROY)
  fun onDestroy(@NotNull lifecycleOwner: LifecycleOwner)

  @OnLifecycleEvent(Lifecycle.Event.ON_ANY)
  fun onLifecycleChanged(@NotNull lifecycleOwner: LifecycleOwner,
                         @NotNull event: Lifecycle.Event)
}